package cn.lyjuan.payment.third.base.model.pay.check;

import java.time.LocalDateTime;

public class PayCheck
{
    /**
     * 最大通知次数
     */
    public static final Integer NOTIFY_MAX_COUNT = 16;

    /**
     * 根据已通知次数计算下次通知时间
     * @param count
     * @return
     */
    public static LocalDateTime nextNotify(int count)
    {
        LocalDateTime curr = LocalDateTime.now();

        if (count == 0) return curr;

        if (count <= 10) return curr.plusMinutes(count);

        if (count > 13) return curr.plusMinutes(120);// 2小时

        return curr.plusMinutes(30 << (count - 11));// 11=30m, 12=60m, 13=120m
    }

    /**
     * 是否最大通知次数
     * @param count
     * @return
     */
    public static boolean isNotifyMax(int count)
    {
        return count >= NOTIFY_MAX_COUNT;
    }
}
